package com.chris.common.config;

import io.minio.MinioClient;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;


@Component
@Slf4j
public class MinioConfig {

    @Value("${minio.server.ip:http://192.168.202.129:9000}")
    private String serviceIp;
    @Value("${minio.server.username:admin}")
    private String username;
    @Value("${minio.server.password:123456789}")
    private String pwd;

    @Bean
    public MinioClient init() {
        log.info("--Minio 连接成功--");
        return MinioClient.builder()
                .endpoint(serviceIp)
                .credentials(username, pwd)
                .build();

    }
}
